## Table A2: Effects of Neighborhood Race and Income on Expected Wait Times: Controlling for Unmea- sured Need

## install.packages(c("tidyverse", "fixest"))
## library(tidyverse)

## SET WORKING DIRECTORY HERE
## setwd()

## Loading data
## load("dta.RData")

## Column 1
race_expected_across_controls <- feols(log_expected_time ~ factor(white_third)  + I(log(distance)) + I(log(pop_per_sq_mi)) + NatWalkInd|
                                                 city^ open_month^open_year, cluster = "geo", data = dta %>% filter(city != "New York"))

## Column 2
race_expected_within_controls <- feols(log_expected_time ~ factor(white_third) + I(log(distance)) + I(log(pop_per_sq_mi)) + NatWalkInd |
                                                 city_service^ open_month^open_year, cluster = "geo", data = dta %>% filter(city != "New York"))

## Column 3
inc_expected_across_controls <- feols(log_expected_time ~ factor(inc_third) + I(log(distance)) + I(log(pop_per_sq_mi)) + NatWalkInd |
                                                city^ open_month^open_year, cluster = "geo", data = dta %>% filter(city != "New York"))

## Column 4
inc_expected_within_controls <- feols(log_expected_time ~ factor(inc_third) + I(log(distance)) + I(log(pop_per_sq_mi)) + NatWalkInd |
                                                city_service^ open_month^open_year, cluster = "geo", data = dta %>% filter(city != "New York"))


TableA2 = etable(race_expected_across_controls, race_expected_within_controls,
                 inc_expected_across_controls, inc_expected_within_controls,
                 signifCode = c("+" = 0.10, "*" = 0.05, "**" = 0.01, "***" = 0.001),
                 digits = 3, digits.stats = 3, fitstat =c("n","r2"))